<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="LBonusApply" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<alias>
    <typeAlias alias="LBonusApply" type="EIA.PM.Model.LBonusApply, EIA.PM.Model" />
</alias>

<resultMaps>
<resultMap id="select-lbonusapply-result" class="LBonusApply">
<constructor>
    <argument argumentName="bns_id" column="bns_id"/>
    <argument argumentName="prj_id" column="prj_id"/>
    <argument argumentName="app_for_date" column="app_for_date"/>
    <argument argumentName="ded_amount" column="ded_amount"/>
    <argument argumentName="ded2_amount" column="ded2_amount"/>
    <argument argumentName="app_amount" column="app_amount"/>
    <argument argumentName="work_rate" column="work_rate"/>
    <argument argumentName="cut_rate" column="cut_rate"/>
    <argument argumentName="app_bonus" column="app_bonus"/>
    <argument argumentName="app_state" column="app_state"/>
    <argument argumentName="_date" column="_date"/>
    <argument argumentName="_staff" column="_staff"/>
</constructor>
<!--
    <result property="BnsId" column="bns_id"/>
    <result property="PrjId" column="prj_id"/>
    <result property="AppForDate" column="app_for_date"/>
    <result property="DedAmount" column="ded_amount"/>
    <result property="Ded2Amount" column="ded2_amount"/>
    <result property="AppAmount" column="app_amount"/>
    <result property="WorkRate" column="work_rate"/>
    <result property="CutRate" column="cut_rate"/>
    <result property="AppBonus" column="app_bonus"/>
    <result property="AppState" column="app_state"/>
    <result property="Date" column="_date"/>
    <result property="Staff" column="_staff"/>
-->
</resultMap>
</resultMaps>

<statements>
<sql id="sql_LBonusApply_where_pk">
WHERE bns_id=#BnsId#
</sql>

<sql id="sql_LBonusApply_where_cv">
<dynamic prepend="WHERE">
    <isPropertyAvailable property="BnsId" prepend="AND">bns_id=#BnsId#</isPropertyAvailable>
    <isPropertyAvailable property="PrjId" prepend="AND">prj_id=#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="AppForDate" prepend="AND">app_for_date=#AppForDate#</isPropertyAvailable>
    <isPropertyAvailable property="DedAmount" prepend="AND">ded_amount=#DedAmount#</isPropertyAvailable>
    <isPropertyAvailable property="Ded2Amount" prepend="AND">ded2_amount=#Ded2Amount#</isPropertyAvailable>
    <isPropertyAvailable property="AppAmount" prepend="AND">app_amount=#AppAmount#</isPropertyAvailable>
    <isPropertyAvailable property="WorkRate" prepend="AND">work_rate=#WorkRate#</isPropertyAvailable>
    <isPropertyAvailable property="CutRate" prepend="AND">cut_rate=#CutRate#</isPropertyAvailable>
    <isPropertyAvailable property="AppBonus" prepend="AND">app_bonus=#AppBonus#</isPropertyAvailable>
    <isPropertyAvailable property="AppState" prepend="AND">app_state=#AppState#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend="AND">_date=#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend="AND">_staff=#Staff#</isPropertyAvailable>
</dynamic>
</sql>

<sql id="sql_LBonusApply_set_cols">
<dynamic prepend="SET">
    <isPropertyAvailable property="PrjId" prepend=",">prj_id=#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="AppForDate" prepend=",">app_for_date=#AppForDate#</isPropertyAvailable>
    <isPropertyAvailable property="DedAmount" prepend=",">ded_amount=#DedAmount#</isPropertyAvailable>
    <isPropertyAvailable property="Ded2Amount" prepend=",">ded2_amount=#Ded2Amount#</isPropertyAvailable>
    <isPropertyAvailable property="AppAmount" prepend=",">app_amount=#AppAmount#</isPropertyAvailable>
    <isPropertyAvailable property="WorkRate" prepend=",">work_rate=#WorkRate#</isPropertyAvailable>
    <isPropertyAvailable property="CutRate" prepend=",">cut_rate=#CutRate#</isPropertyAvailable>
    <isPropertyAvailable property="AppBonus" prepend=",">app_bonus=#AppBonus#</isPropertyAvailable>
    <isPropertyAvailable property="AppState" prepend=",">app_state=#AppState#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">_date=#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">_staff=#Staff#</isPropertyAvailable>
</dynamic>
</sql>

<select id="SelectLBonusApply" parameterClass="" resultMap="LBonusApply.select-lbonusapply-result">
SELECT *
FROM l_bonus_apply
<include refid="sql_LBonusApply_where_pk"/><!--where-->
</select>

<select id="SelectLBonusApply_CV" parameterClass="System.Collections.IDictionary" resultMap="LBonusApply.select-lbonusapply-result">
SELECT *
FROM l_bonus_apply
<include refid="sql_LBonusApply_where_cv"/><!--where-->
</select>

<insert id="InsertLBonusApply" parameterClass="LBonusApply">
<!--pre selectKey place-->
INSERT INTO l_bonus_apply(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjId" prepend=",">prj_id</isPropertyAvailable>
    <isPropertyAvailable property="AppForDate" prepend=",">app_for_date</isPropertyAvailable>
    <isPropertyAvailable property="DedAmount" prepend=",">ded_amount</isPropertyAvailable>
    <isPropertyAvailable property="Ded2Amount" prepend=",">ded2_amount</isPropertyAvailable>
    <isPropertyAvailable property="AppAmount" prepend=",">app_amount</isPropertyAvailable>
    <isPropertyAvailable property="WorkRate" prepend=",">work_rate</isPropertyAvailable>
    <isPropertyAvailable property="CutRate" prepend=",">cut_rate</isPropertyAvailable>
    <isPropertyAvailable property="AppBonus" prepend=",">app_bonus</isPropertyAvailable>
    <isPropertyAvailable property="AppState" prepend=",">app_state</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">_date</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">_staff</isPropertyAvailable>
</dynamic>
)VALUES(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjId" prepend=",">#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="AppForDate" prepend=",">#AppForDate#</isPropertyAvailable>
    <isPropertyAvailable property="DedAmount" prepend=",">#DedAmount#</isPropertyAvailable>
    <isPropertyAvailable property="Ded2Amount" prepend=",">#Ded2Amount#</isPropertyAvailable>
    <isPropertyAvailable property="AppAmount" prepend=",">#AppAmount#</isPropertyAvailable>
    <isPropertyAvailable property="WorkRate" prepend=",">#WorkRate#</isPropertyAvailable>
    <isPropertyAvailable property="CutRate" prepend=",">#CutRate#</isPropertyAvailable>
    <isPropertyAvailable property="AppBonus" prepend=",">#AppBonus#</isPropertyAvailable>
    <isPropertyAvailable property="AppState" prepend=",">#AppState#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">#Staff#</isPropertyAvailable>
</dynamic>
)
<selectKey resultClass="int" type="post" property="BnsId" >
SELECT LAST_INSERT_ID()
</selectKey>
</insert>

<update id="UpdateLBonusApply" parameterClass="System.Collections.IDictionary">
UPDATE l_bonus_apply
<include refid="sql_LBonusApply_set_cols"/><!--set-->
<include refid="sql_LBonusApply_where_pk"/><!--where-->
</update>

<delete id="DeleteLBonusApply" parameterClass="">
DELETE FROM l_bonus_apply
<include refid="sql_LBonusApply_where_pk"/><!--where-->
</delete>

<statement id="DeleteLBonusApply_CV" parameterClass="LBonusApply">
DELETE FROM l_bonus_apply
<include refid="sql_LBonusApply_where_cv"/><!--where-->
</statement>

<delete id="ClearLBonusApply">
DELETE FROM l_bonus_apply
</delete>
</statements>
</sqlMap>